/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.entity.product;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.neusoft.lohas.common.persistence.IdEntity;
import com.neusoft.lohas.modules.ivm.entity.merchant.Merchant;

/**
 * 供应商Entity
 * @author Jackie.Liu
 * @version 2014-12-30
 */
@Entity
@Table(name = "ivm_supplier")
@DynamicInsert
@DynamicUpdate
public class Supplier extends IdEntity<Supplier> {

	private static final long serialVersionUID = 1L;
	private Merchant merchant; //所属商户
	private String name; 	// 名称
	private String phone;   //供应商电话
	private String address;   //供应商地址

	public Supplier() {
		super();
	}

	public Supplier(String id){
		this();
		this.id = id;
	}

	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@ManyToOne
	@JoinColumn(name="merchant_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@NotNull(message="归属商户不能为空")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}


